<?php
namespace Umpmobile\Model;
use Think\Model;
class FriendshipsModel extends Model{
	public $guest_mixednick; //朋友的昵称
	public $home_mixednick; //自己的昵称
	public $guest_id; //朋友的ID
	public $home_id; //自己的ID
	public $activity_id; //平台的折扣ID
	public $promo_id; //本地折扣ID
	public $promo_cat_id; //本地活动ID
	public $invite_order; //邀请顺序
	public $sid;
	public function addFriendShip(){
		$data["home_mixednick"] = $this->home_mixednick;
		$data["guest_mixednick"] = $this->guest_mixednick;
		$data["home_id"] = $this->home_id;
		$data["guest_id"] = $this->guest_id;
		$data["invite_time"] = date("Y-m-d H:i:s");
		$data["sid"] = $this->sid;
		$data["activity_id"] = $this->activity_id;
		$data["promo_id"] = $this->promo_id;
		$data["promo_cat_id"] = $this->promo_cat_id;
		$data["invite_order"] = $this->invite_order;
		return $this->add($data);
	}
	public function getFriendShip(){
		$data["sid"] = $this->sid;
		$data["home_id"] = $this->home_id;
		$data["guest_id"] = $this->guest_id;
		$data["promo_cat_id"] = $this->promo_cat_id;
		return $this->where($data)->getField("`id`,`invite_time`,`activity_id`,`promo_id`");
	}
}